package com.xx.pmis.web.forms;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class LoginForm extends ActionForm {
	private static final long serialVersionUID = -7483899856181655983L;
	private String username;//用户名
	private String password;//密码

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();

		if ((this.username == null) || (this.username.equals(""))) {
			errors.add("username", new ActionMessage("用户名为空！"));
		}
		if ((this.password == null) || (this.password.equals(""))) {
			errors.add("password", new ActionMessage("密码为空！"));
		}
		return errors;
	}
}